package com.saml.demo.sp.controller;

import com.google.common.collect.Lists;
import com.saml.demo.sp.vo.ProductVo;
import lombok.extern.log4j.Log4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 商品控制器
 * Created by Derry Luo on 2019/5/6.
 */
@Controller
@RequestMapping("/sp/securesource/product")
@Log4j
public class ProductController {

    @RequestMapping("listpage")
    public String productPage(){
        log.info("request product list page.");
        return "/product";
    }

    @RequestMapping("getavailableproduct")
    @ResponseBody
    public List<ProductVo> getAvailableProduct() {

        return Lists.newArrayList(new ProductVo(1, "Apple"), new ProductVo(2, "banana"));
    }


}
